<!doctype html>
<html lang="en">
<head>
    <!-- 引入Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <style>
        body {
            background-color: #f8f9fa;
            font-family: 'Arial', sans-serif;
            color: #343a40;
        }
        .container {
            max-width: 700px;
            margin-top: 50px;
            padding: 30px;
            background-color: #fff;
            border-radius: 15px;
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }
        .container:hover {
            transform: translateY(-5px);
            box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
        }
        h2 {
            color: #0056b3;
            text-align: center;
            margin-bottom: 30px;
        }
        .form-control:focus {
            border-color: #007bff;
            box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
        }
        .btn-primary {
            background-color: #007bff;
            border-color: #007bff;
            padding: 10px 20px;
            font-size: 1rem;
            border-radius: 5px;
            transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
        }
        .btn-primary:hover {
            background-color: #0056b3;
            border-color: #004999;
            transform: scale(1.05);
        }
        .alert {
            border-radius: 10px;
            margin-bottom: 20px;
        }
        .alert ul {
            margin-bottom: 0;
            padding-left: 20px;
        }
        .form-label {
            font-weight: bold;
        }
        .form-group {
            margin-bottom: 20px;
        }
        textarea.form-control {
            min-height: 100px;
        }
        .submit-btn {
            display: flex;
            justify-content: center;
            margin-top: 20px;
        }
    </style>
    <title><?= esc($heading) ?></title>
</head>
<body>
<div class="container">
    <h2><?= esc($heading) ?></h2>

    <?php if (session('errors')): ?>
        <div class="alert alert-danger alert-dismissible fade show" role="alert">
            <ul>
                <?php foreach (session('errors') as $field => $error): ?>
                    <li><?= esc($error) ?></li>
                <?php endforeach; ?>
            </ul>
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
    <?php endif; ?>

    <?php if (session('error')): ?>
        <div class="alert alert-danger alert-dismissible fade show" role="alert">
            <?= esc(session('error')) ?>
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
    <?php endif; ?>

    <?php if (session('success')): ?>
        <div class="alert alert-success alert-dismissible fade show" role="alert">
            <?= esc(session('success')) ?>
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
    <?php endif; ?>

    <form action="<?= base_url('hockey/create') ?>" method="post" class="row g-3">
        <?= csrf_field() ?>

        <div class="col-md-12 form-group">
            <label for="name" class="form-label">Name:</label>
            <input type="text" class="form-control" id="name" name="name" value="<?= set_value('name') ?>">
        </div>

        <div class="col-md-12 form-group">
            <label for="description" class="form-label">Description:</label>
            <textarea class="form-control" id="description" name="description"><?= set_value('description') ?></textarea>
        </div>

        <div class="col-md-6 form-group">
            <label for="link" class="form-label">Link:</label>
            <input type="text" class="form-control" id="link" name="link" value="<?= set_value('link') ?>">
        </div>

        <div class="col-md-6 form-group">
            <label for="image" class="form-label">Image URL:</label>
            <input type="text" class="form-control" id="image" name="image" value="<?= set_value('image') ?>">
        </div>

        <div class="col-md-6 form-group">
            <label for="city" class="form-label">City:</label>
            <input type="text" class="form-control" id="city" name="city" value="<?= set_value('city') ?>">
        </div>

        <div class="col-md-6 form-group">
            <label for="powers" class="form-label">Powers:</label>
            <textarea class="form-control" id="powers" name="powers"><?= set_value('powers') ?></textarea>
        </div>

        <div class="col-md-6 form-group">
            <label for="weapon" class="form-label">Weapon:</label>
            <input type="text" class="form-control" id="weapon" name="weapon" value="<?= set_value('weapon') ?>">
        </div>

        <div class="submit-btn">
            <button type="submit" class="btn btn-primary px-5">Create</button>
        </div>
    </form>
</div>

<!-- 引入Bootstrap JS和依赖 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
</body>
</html>